
var $j = jQuery.noConflict();


if ($j.browser.msie && $j.browser.version == "6.0") {
	/**
	* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
	* Author: Drew Diller
	* Email: drew.diller@gmail.com
	* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
	* Version: 0.0.8a
	* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
	*
	* Example usage:
	* DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
	* DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
	**/
	var DD_belatedPNG={ns:"DD_belatedPNG",imgSize:{},delay:10,nodesFixed:0,createVmlNameSpace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createVmlStyleSheet:function(){var b,a;b=document.createElement("style");b.setAttribute("media","screen");document.documentElement.firstChild.insertBefore(b,document.documentElement.firstChild.firstChild);if(b.styleSheet){b=b.styleSheet;b.addRule(this.ns+"\\:*","{behavior:url(#default#VML)}");b.addRule(this.ns+"\\:shape","position:absolute;");b.addRule("img."+this.ns+"_sizeFinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;");this.screenStyleSheet=b;a=document.createElement("style");a.setAttribute("media","print");document.documentElement.firstChild.insertBefore(a,document.documentElement.firstChild.firstChild);a=a.styleSheet;a.addRule(this.ns+"\\:*","{display: none !important;}");a.addRule("img."+this.ns+"_sizeFinder","{display: none !important;}")}},readPropertyChange:function(){var b,c,a;b=event.srcElement;if(!b.vmlInitiated){return}if(event.propertyName.search("background")!=-1||event.propertyName.search("border")!=-1){DD_belatedPNG.applyVML(b)}if(event.propertyName=="style.display"){c=(b.currentStyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasOwnProperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyName.search("filter")!=-1){DD_belatedPNG.vmlOpacity(b)}},vmlOpacity:function(b){if(b.currentStyle.filter.search("lpha")!=-1){var a=b.currentStyle.filter;a=parseInt(a.substring(a.lastIndexOf("=")+1,a.lastIndexOf(")")),10)/100;b.vml.color.shape.style.filter=b.currentStyle.filter;b.vml.image.fill.opacity=a}},handlePseudoHover:function(a){setTimeout(function(){DD_belatedPNG.applyVML(a)},1)},fix:function(a){if(this.screenStyleSheet){var c,b;c=a.split(",");for(b=0;b<c.length;b++){this.screenStyleSheet.addRule(c[b],"behavior:expression(DD_belatedPNG.fixPng(this))")}}},applyVML:function(a){a.runtimeStyle.cssText="";this.vmlFill(a);this.vmlOffsets(a);this.vmlOpacity(a);if(a.isImg){this.copyImageBorders(a)}},attachHandlers:function(i){var d,c,g,e,b,f;d=this;c={resize:"vmlOffsets",move:"vmlOffsets"};if(i.nodeName=="A"){e={mouseleave:"handlePseudoHover",mouseenter:"handlePseudoHover",focus:"handlePseudoHover",blur:"handlePseudoHover"};for(b in e){if(e.hasOwnProperty(b)){c[b]=e[b]}}}for(f in c){if(c.hasOwnProperty(f)){g=function(){d[c[f]](i)};i.attachEvent("on"+f,g)}}i.attachEvent("onpropertychange",this.readPropertyChange)},giveLayout:function(a){a.style.zoom=1;if(a.currentStyle.position=="static"){a.style.position="relative"}},copyImageBorders:function(b){var c,a;c={borderStyle:true,borderWidth:true,borderColor:true};for(a in c){if(c.hasOwnProperty(a)){b.vml.color.shape.style[a]=b.currentStyle[a]}}},vmlFill:function(e){if(!e.currentStyle){return}else{var d,f,g,b,a,c;d=e.currentStyle}for(b in e.vml){if(e.vml.hasOwnProperty(b)){e.vml[b].shape.style.zIndex=d.zIndex}}e.runtimeStyle.backgroundColor="";e.runtimeStyle.backgroundImage="";f=true;if(d.backgroundImage!="none"||e.isImg){if(!e.isImg){e.vmlBg=d.backgroundImage;e.vmlBg=e.vmlBg.substr(5,e.vmlBg.lastIndexOf('")')-5)}else{e.vmlBg=e.src}g=this;if(!g.imgSize[e.vmlBg]){a=document.createElement("img");g.imgSize[e.vmlBg]=a;a.className=g.ns+"_sizeFinder";a.runtimeStyle.cssText="behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;";c=function(){this.width=this.offsetWidth;this.height=this.offsetHeight;g.vmlOffsets(e)};a.attachEvent("onload",c);a.src=e.vmlBg;a.removeAttribute("width");a.removeAttribute("height");document.body.insertBefore(a,document.body.firstChild)}e.vml.image.fill.src=e.vmlBg;f=false}e.vml.image.fill.on=!f;e.vml.image.fill.color="none";e.vml.color.shape.style.backgroundColor=d.backgroundColor;e.runtimeStyle.backgroundImage="none";e.runtimeStyle.backgroundColor="transparent"},vmlOffsets:function(d){var h,n,a,e,g,m,f,l,j,i,k;h=d.currentStyle;n={W:d.clientWidth+1,H:d.clientHeight+1,w:this.imgSize[d.vmlBg].width,h:this.imgSize[d.vmlBg].height,L:d.offsetLeft,T:d.offsetTop,bLW:d.clientLeft,bTW:d.clientTop};a=(n.L+n.bLW==1)?1:0;e=function(b,p,q,c,s,u){b.coordsize=c+","+s;b.coordorigin=u+","+u;b.path="m0,0l"+c+",0l"+c+","+s+"l0,"+s+" xe";b.style.width=c+"px";b.style.height=s+"px";b.style.left=p+"px";b.style.top=q+"px"};e(d.vml.color.shape,(n.L+(d.isImg?0:n.bLW)),(n.T+(d.isImg?0:n.bTW)),(n.W-1),(n.H-1),0);e(d.vml.image.shape,(n.L+n.bLW),(n.T+n.bTW),(n.W),(n.H),1);g={X:0,Y:0};if(d.isImg){g.X=parseInt(h.paddingLeft,10)+1;g.Y=parseInt(h.paddingTop,10)+1}else{for(j in g){if(g.hasOwnProperty(j)){this.figurePercentage(g,n,j,h["backgroundPosition"+j])}}}d.vml.image.fill.position=(g.X/n.W)+","+(g.Y/n.H);m=h.backgroundRepeat;f={T:1,R:n.W+a,B:n.H,L:1+a};l={X:{b1:"L",b2:"R",d:"W"},Y:{b1:"T",b2:"B",d:"H"}};if(m!="repeat"||d.isImg){i={T:(g.Y),R:(g.X+n.w),B:(g.Y+n.h),L:(g.X)};if(m.search("repeat-")!=-1){k=m.split("repeat-")[1].toUpperCase();i[l[k].b1]=1;i[l[k].b2]=n[l[k].d]}if(i.B>n.H){i.B=n.H}d.vml.image.shape.style.clip="rect("+i.T+"px "+(i.R+a)+"px "+i.B+"px "+(i.L+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.T+"px "+f.R+"px "+f.B+"px "+f.L+"px)"}},figurePercentage:function(d,c,f,a){var b,e;e=true;b=(f=="X");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseInt(a,10)/100}else{e=false}}d[f]=Math.ceil(e?((c[b?"W":"H"]*d[f])-(c[b?"w":"h"]*d[f])):parseInt(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixPng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodeName=="BODY"||c.nodeName=="TD"||c.nodeName=="TR"){return}c.isImg=false;if(c.nodeName=="IMG"){if(c.src.toLowerCase().search(/\.png$/)!=-1){c.isImg=true;c.style.visibility="hidden"}else{return}}else{if(c.currentStyle.backgroundImage.toLowerCase().search(".png")==-1){return}}g=DD_belatedPNG;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasOwnProperty(a)){for(d in b){if(b.hasOwnProperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createElement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendChild(c.vml[a].fill);c.parentNode.insertBefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachHandlers(c);g.giveLayout(c);g.giveLayout(c.offsetParent);c.vmlInitiated=true;g.applyVML(c)}};try{document.execCommand("BackgroundImageCache",false,true)}catch(r){}DD_belatedPNG.createVmlNameSpace();DD_belatedPNG.createVmlStyleSheet();
	DD_belatedPNG.fix("*");
};

/*******************************************************************************************
 * as - is jQuery Plugin import
 *******************************************************************************************/
/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.2 (20/10/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

/*
*/
;(function(a){var m,t,u,f,D,h,E,n,z,A,q=0,e={},o=[],p=0,c={},l=[],I=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,j,i=false,B=a.extend(a("<div/>")[0],{prop:0}),M=a.browser.msie&&a.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;I&&I.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();i=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},H=function(){var b=o[q],d,g,k,C,P,w;N();e=a.extend({},a.fn.fancybox.defaults,typeof a(b).data("fancybox")=="undefined"?e:a(b).data("fancybox"));w=e.onStart(o,q,e);if(w===false)i=false;else{if(typeof w=="object")e=a.extend(e,w);k=e.title||(b.nodeName?a(b).attr("title"):b.title)||"";if(b.nodeName&&!e.orig)e.orig=a(b).children("img:first").length?a(b).children("img:first"):a(b);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");d=e.href||(b.nodeName?a(b).attr("href"):b.href)||null;if(/^(?:javascript)/i.test(d)||
d=="#")d=null;if(e.type){g=e.type;if(!d)d=e.content}else if(e.content)g="html";else if(d)g=d.match(J)?"image":d.match(W)?"swf":a(b).hasClass("iframe")?"iframe":d.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){b=d.substr(d.indexOf("#"));g=a(b).length>0?"inline":"ajax"}e.type=g;e.href=d;e.title=k;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;
e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);a(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){a(this).replaceWith(h.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(a(b).parent().is("#fancybox-content")===true){i=false;break}a('<div class="fancybox-inline-tmp" />').hide().insertBefore(a(b)).bind("fancybox-cleanup",function(){a(this).replaceWith(h.children())}).bind("fancybox-cancel",
function(){a(this).replaceWith(m.children())});a(b).appendTo(m);F();break;case "image":i=false;a.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){i=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;a("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=d;break;case "swf":C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+d+'"></param>';P="";
a.each(e.swf,function(x,G){C+='<param name="'+x+'" value="'+G+'"></param>';P+=" "+x+'="'+G+'"'});C+='<embed src="'+d+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":i=false;a.fancybox.showActivity();e.ajax.win=e.ajax.success;I=a.ajax(a.extend({},e.ajax,{url:d,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,G,U){if(U.status==200){if(typeof e.ajax.win=="function"){w=e.ajax.win(d,x,G,
U);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();Q()},Q=function(){var b,d;t.hide();if(f.is(":visible")&&false===true){a.event.trigger("fancybox-cancel");i=false}else{i=true;a(h.add(u)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");f.is(":visible")&&
c.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;c=e;if(c.overlayShow){u.css({"background-color":c.overlayColor,opacity:c.overlayOpacity,cursor:c.hideOnOverlayClick?"pointer":"auto",height:a(document).height()});if(!u.is(":visible")){M&&a("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();h.get(0).scrollTop=0;h.get(0).scrollLeft=
0;j=X();s=c.title||"";y=0;n.empty().removeAttr("style").removeClass();if(c.titleShow!==false){if(a.isFunction(c.titleFormat))b=c.titleFormat(s,l,p,c);else b=s&&s.length?c.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+c.titlePosition+'">'+s+"</div>":false;s=b;if(!(!s||s==="")){n.addClass("fancybox-title-"+
c.titlePosition).html(s).appendTo("body").show();switch(c.titlePosition){case "inside":n.css({width:j.width-c.padding*2,marginLeft:c.padding,marginRight:c.padding});y=n.outerHeight(true);n.appendTo(D);j.height+=y;break;case "over":n.css({marginLeft:c.padding,width:j.width-c.padding*2,bottom:c.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-j.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:j.width-c.padding*2,paddingLeft:c.padding,paddingRight:c.padding}).appendTo(f)}}}n.hide();
if(f.is(":visible")){a(E.add(z).add(A)).hide();b=f.position();r={top:b.top,left:b.left,width:f.width(),height:f.height()};d=r.width==j.width&&r.height==j.height;h.fadeTo(c.changeFade,0.3,function(){var g=function(){h.html(m.contents()).fadeTo(c.changeFade,1,R)};a.event.trigger("fancybox-change");h.empty().removeAttr("filter").css({"border-width":c.padding,width:j.width-c.padding*2,height:c.type=="image"||c.type=="swf"||c.type=="iframe"?j.height-y-c.padding*2:"auto"});if(d)g();else{B.prop=0;a(B).animate({prop:1},
{duration:c.changeSpeed,easing:c.easingChange,step:S,complete:g})}})}else{f.removeAttr("style");h.css("border-width",c.padding);if(c.transitionIn=="elastic"){r=V();h.html(m.contents());f.show();if(c.opacity)j.opacity=0;B.prop=0;a(B).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:S,complete:R})}else{c.titlePosition=="inside"&&y>0&&n.show();h.css({width:j.width-c.padding*2,height:c.type=="image"||c.type=="swf"||c.type=="iframe"?j.height-y-c.padding*2:"auto"}).html(m.contents());f.css(j).fadeIn(c.transitionIn==
"none"?0:c.fadeIn,R)}}}},Y=function(){if(c.enableEscapeButton||c.enableKeyboardNav)a(document).bind("keydown.fb",function(b){if(b.keyCode==27&&c.enableEscapeButton){b.preventDefault();a.fancybox.close()}else if((b.keyCode==37||b.keyCode==39)&&c.enableKeyboardNav&&b.target.tagName!=="INPUT"&&b.target.tagName!=="TEXTAREA"&&b.target.tagName!=="SELECT"){b.preventDefault();a.fancybox[b.keyCode==37?"prev":"next"]()}});if(c.showNavArrows){if(c.cyclic&&l.length>1||p!==0)z.show();if(c.cyclic&&l.length>1||
p!=l.length-1)A.show()}else{z.hide();A.hide()}},R=function(){if(!a.support.opacity){h.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}f.css("height","auto");c.type!=="image"&&c.type!=="swf"&&c.type!=="iframe"&&h.css("height","auto");s&&s.length&&n.show();c.showCloseButton&&E.show();Y();c.hideOnContentClick&&h.bind("click",a.fancybox.close);c.hideOnOverlayClick&&u.bind("click",a.fancybox.close);a(window).bind("resize.fb",a.fancybox.resize);c.centerOnScroll&&a(window).bind("scroll.fb",
a.fancybox.center);if(c.type=="iframe")a('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(a.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+c.href+'"></iframe>').appendTo(h);f.show();i=false;a.fancybox.center();c.onComplete(l,p,c);var b,d;if(l.length-1>p){b=l[p+1].href;if(typeof b!=="undefined"&&b.match(J)){d=new Image;d.src=b}}if(p>0){b=l[p-1].href;if(typeof b!=="undefined"&&b.match(J)){d=new Image;d.src=b}}},
S=function(b){var d={width:parseInt(r.width+(j.width-r.width)*b,10),height:parseInt(r.height+(j.height-r.height)*b,10),top:parseInt(r.top+(j.top-r.top)*b,10),left:parseInt(r.left+(j.left-r.left)*b,10)};if(typeof j.opacity!=="undefined")d.opacity=b<0.5?0.5:b;f.css(d);h.css({width:d.width-c.padding*2,height:d.height-y*b-c.padding*2})},T=function(){return[a(window).width()-c.margin*2,a(window).height()-c.margin*2,a(document).scrollLeft()+c.margin,a(document).scrollTop()+c.margin]},X=function(){var b=
T(),d={},g=c.autoScale,k=c.padding*2;d.width=c.width.toString().indexOf("%")>-1?parseInt(b[0]*parseFloat(c.width)/100,10):c.width+k;d.height=c.height.toString().indexOf("%")>-1?parseInt(b[1]*parseFloat(c.height)/100,10):c.height+k;if(g&&(d.width>b[0]||d.height>b[1]))if(e.type=="image"||e.type=="swf"){g=c.width/c.height;if(d.width>b[0]){d.width=b[0];d.height=parseInt((d.width-k)/g+k,10)}if(d.height>b[1]){d.height=b[1];d.width=parseInt((d.height-k)*g+k,10)}}else{d.width=Math.min(d.width,b[0]);d.height=
Math.min(d.height,b[1])}d.top=parseInt(Math.max(b[3]-20,b[3]+(b[1]-d.height-40)*0.5),10);d.left=parseInt(Math.max(b[2]-20,b[2]+(b[0]-d.width-40)*0.5),10);return d},V=function(){var b=e.orig?a(e.orig):false,d={};if(b&&b.length){d=b.offset();d.top+=parseInt(b.css("paddingTop"),10)||0;d.left+=parseInt(b.css("paddingLeft"),10)||0;d.top+=parseInt(b.css("border-top-width"),10)||0;d.left+=parseInt(b.css("border-left-width"),10)||0;d.width=b.width();d.height=b.height();d={width:d.width+c.padding*2,height:d.height+
c.padding*2,top:d.top-c.padding-20,left:d.left-c.padding-20}}else{b=T();d={width:c.padding*2,height:c.padding*2,top:parseInt(b[3]+b[1]*0.5,10),left:parseInt(b[2]+b[0]*0.5,10)}}return d},Z=function(){if(t.is(":visible")){a("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};a.fn.fancybox=function(b){if(!a(this).length)return this;a(this).data("fancybox",a.extend({},b,a.metadata?a(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!i){i=true;a(this).blur();
o=[];q=0;d=a(this).attr("rel")||"";if(!d||d==""||d==="nofollow")o.push(this);else{o=a("a[rel="+d+"], area[rel="+d+"]");q=o.index(this)}H()}});return this};a.fancybox=function(b,d){var g;if(!i){i=true;g=typeof d!=="undefined"?d:{};o=[];q=parseInt(g.index,10)||0;if(a.isArray(b)){for(var k=0,C=b.length;k<C;k++)if(typeof b[k]=="object")a(b[k]).data("fancybox",a.extend({},g,b[k]));else b[k]=a({}).data("fancybox",a.extend({content:b[k]},g));o=jQuery.merge(o,b)}else{if(typeof b=="object")a(b).data("fancybox",
a.extend({},g,b));else b=a({}).data("fancybox",a.extend({content:b},g));o.push(b)}if(q>o.length||q<0)q=0;H()}};a.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};a.fancybox.hideActivity=function(){t.hide()};a.fancybox.next=function(){return a.fancybox.pos(p+1)};a.fancybox.prev=function(){return a.fancybox.pos(p-1)};a.fancybox.pos=function(b){if(!i){b=parseInt(b);o=l;if(b>-1&&b<l.length){q=b;H()}else if(c.cyclic&&l.length>1){q=b>=l.length?0:l.length-1;H()}}};a.fancybox.cancel=
function(){if(!i){i=true;a.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);i=false}};a.fancybox.close=function(){function b(){u.fadeOut("fast");n.empty().hide();f.hide();a.event.trigger("fancybox-cleanup");h.empty();c.onClosed(l,p,c);l=e=[];p=q=0;c=e={};i=false}
//if(!(i||f.is(":hidden")))
{i=true;
//if(c&&false===c.onCleanup(l,p,c)) // 이전
if(c&&false==false) //onCleanup 스크립트 오류로 치환 처리함(kkd).  
i=false;
else{N();a(E.add(z).add(A)).hide();a(h.add(u)).unbind();a(window).unbind("resize.fb scroll.fb");a(document).unbind("keydown.fb");h.find("iframe").attr("src",M&&
/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");c.titlePosition!=="inside"&&n.empty();f.stop();if(c.transitionOut=="elastic"){r=V();var d=f.position();j={top:d.top,left:d.left,width:f.width(),height:f.height()};if(c.opacity)j.opacity=1;n.empty().hide();B.prop=1;a(B).animate({prop:0},{duration:c.speedOut,easing:c.easingOut,step:S,complete:b})}else f.fadeOut(c.transitionOut=="none"?0:c.speedOut,b)}}};a.fancybox.resize=function(){u.is(":visible")&&u.css("height",a(document).height());
a.fancybox.center(true)};a.fancybox.center=function(b){var d,g;if(!i){g=b===true?1:0;d=T();!g&&(f.width()>d[0]||f.height()>d[1])||f.stop().animate({top:parseInt(Math.max(d[3]-20,d[3]+(d[1]-h.height()-40)*0.5-c.padding)),left:parseInt(Math.max(d[2]-20,d[2]+(d[0]-h.width()-40)*0.5-c.padding))},typeof b=="number"?b:200)}};a.fancybox.init=function(){if(!a("#fancybox-wrap").length){a("body").append(m=a('<div id="fancybox-tmp"></div>'),t=a('<div id="fancybox-loading"><div></div></div>'),u=a('<div id="fancybox-overlay"></div>'),
f=a('<div id="fancybox-wrap"></div>'));D=a('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(h=a('<div id="fancybox-content"></div>'),E=a('<a id="fancybox-close" title="닫기"></a>'),n=a('<div id="fancybox-title"></div>'),z=a('<a href="#" id="fancybox-left" title="구매관련 개발용 링크"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=a('<a href="#" id="fancybox-right" title="구매관련 개발용 링크"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(a.fancybox.close);t.click(a.fancybox.cancel);z.click(function(b){b.preventDefault();a.fancybox.prev()});A.click(function(b){b.preventDefault();a.fancybox.next()});
a.fn.mousewheel&&f.bind("mousewheel.fb",function(b,d){b.preventDefault();a.fancybox[d>0?"prev":"next"]()});a.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");a('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1" width="0" height="0"></iframe>').prependTo(D)}}};a.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,
scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,
enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};a(document).ready(function(){a.fancybox.init()})})(jQuery);
/*
 * jQuery Form Plugin
 * version: 2.43 (12-MAR-2010)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(b){b.fn.ajaxSubmit=function(s){if(!this.length){a("ajaxSubmit: skipping submit process - no element selected");return this}if(typeof s=="function"){s={success:s}}var e=b.trim(this.attr("action"));if(e){e=(e.match(/^([^#]+)/)||[])[1]}e=e||window.location.href||"";s=b.extend({url:e,type:this.attr("method")||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},s||{});var u={};this.trigger("form-pre-serialize",[this,s,u]);if(u.veto){a("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(s.beforeSerialize&&s.beforeSerialize(this,s)===false){a("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var m=this.formToArray(s.semantic);if(s.data){s.extraData=s.data;for(var f in s.data){if(s.data[f] instanceof Array){for(var g in s.data[f]){m.push({name:f,value:s.data[f][g]})}}else{m.push({name:f,value:s.data[f]})}}}if(s.beforeSubmit&&s.beforeSubmit(m,this,s)===false){a("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[m,this,s,u]);if(u.veto){a("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var d=b.param(m);if(s.type.toUpperCase()=="GET"){s.url+=(s.url.indexOf("?")>=0?"&":"?")+d;s.data=null}else{s.data=d}var t=this,l=[];if(s.resetForm){l.push(function(){t.resetForm()})}if(s.clearForm){l.push(function(){t.clearForm()})}if(!s.dataType&&s.target){var p=s.success||function(){};l.push(function(k){var j=s.replaceTarget?"replaceWith":"html";b(s.target)[j](k).each(p,arguments)})}else{if(s.success){l.push(s.success)}}s.success=function(q,k,v){for(var n=0,j=l.length;n<j;n++){l[n].apply(s,[q,k,v||t,t])}};var c=b("input:file",this).fieldValue();var r=false;for(var i=0;i<c.length;i++){if(c[i]){r=true}}var h=false;if((c.length&&s.iframe!==false)||s.iframe||r||h){if(s.closeKeepAlive){b.get(s.closeKeepAlive,o)}else{o()}}else{b.ajax(s)}this.trigger("form-submit-notify",[this,s]);return this;function o(){var w=t[0];if(b(":input[name=submit]",w).length){alert('Error: Form elements must not be named "submit".');return}var q=b.extend({},b.ajaxSettings,s);var H=b.extend(true,{},b.extend(true,{},b.ajaxSettings),q);var v="jqFormIO"+(new Date().getTime());var D=b('<iframe id="'+v+'" name="'+v+'" src="'+q.iframeSrc+'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />');var F=D[0];D.css({position:"absolute",top:"-1000px",left:"-1000px"});var G={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;D.attr("src",q.iframeSrc)}};var E=q.global;if(E&&!b.active++){b.event.trigger("ajaxStart")}if(E){b.event.trigger("ajaxSend",[G,q])}if(H.beforeSend&&H.beforeSend(G,H)===false){H.global&&b.active--;return}if(G.aborted){return}var k=false;var A=0;var j=w.clk;if(j){var y=j.name;if(y&&!j.disabled){q.extraData=q.extraData||{};q.extraData[y]=j.value;if(j.type=="image"){q.extraData[y+".x"]=w.clk_x;q.extraData[y+".y"]=w.clk_y}}}function x(){var K=t.attr("target"),I=t.attr("action");w.setAttribute("target",v);if(w.getAttribute("method")!="POST"){w.setAttribute("method","POST")}if(w.getAttribute("action")!=q.url){w.setAttribute("action",q.url)}if(!q.skipEncodingOverride){t.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(q.timeout){setTimeout(function(){A=true;B()},q.timeout)}var J=[];try{if(q.extraData){for(var L in q.extraData){J.push(b('<input type="hidden" name="'+L+'" value="'+q.extraData[L]+'" />').appendTo(w)[0])}}D.appendTo("body");D.data("form-plugin-onload",B);w.submit()}finally{w.setAttribute("action",I);K?w.setAttribute("target",K):t.removeAttr("target");b(J).remove()}}if(q.forceSync){x()}else{setTimeout(x,10)}var z=100;function B(){if(k){return}var I=true;try{if(A){throw"timeout"}var J,M;M=F.contentWindow?F.contentWindow.document:F.contentDocument?F.contentDocument:F.document;var N=q.dataType=="xml"||M.XMLDocument||b.isXMLDoc(M);a("isXml="+N);if(!N&&(M.body==null||M.body.innerHTML=="")){if(--z){a("requeing onLoad callback, DOM not available");setTimeout(B,250);return}a("Could not access iframe DOM after 100 tries.");return}a("response detected");k=true;G.responseText=M.body?M.body.innerHTML:null;G.responseXML=M.XMLDocument?M.XMLDocument:M;G.getResponseHeader=function(P){var O={"content-type":q.dataType};return O[P]};if(q.dataType=="json"||q.dataType=="script"){var n=M.getElementsByTagName("textarea")[0];if(n){G.responseText=n.value}else{var L=M.getElementsByTagName("pre")[0];if(L){G.responseText=L.innerHTML}}}else{if(q.dataType=="xml"&&!G.responseXML&&G.responseText!=null){G.responseXML=C(G.responseText)}}J=b.httpData(G,q.dataType)}catch(K){a("error caught:",K);I=false;G.error=K;b.handleError(q,G,"error",K)}if(I){q.success(J,"success");if(E){b.event.trigger("ajaxSuccess",[G,q])}}if(E){b.event.trigger("ajaxComplete",[G,q])}if(E&&!--b.active){b.event.trigger("ajaxStop")}if(q.complete){q.complete(G,I?"success":"error")}setTimeout(function(){D.removeData("form-plugin-onload");D.remove();G.responseXML=null},100)}function C(n,I){if(window.ActiveXObject){I=new ActiveXObject("Microsoft.XMLDOM");I.async="false";I.loadXML(n)}else{I=(new DOMParser()).parseFromString(n,"text/xml")}return(I&&I.documentElement&&I.documentElement.tagName!="parsererror")?I:null}}};b.fn.ajaxForm=function(c){return this.ajaxFormUnbind().bind("submit.form-plugin",function(d){d.preventDefault();b(this).ajaxSubmit(c)}).bind("click.form-plugin",function(i){var h=i.target;var f=b(h);if(!(f.is(":submit,input:image"))){var d=f.closest(":submit");if(d.length==0){return}h=d[0]}var g=this;g.clk=h;if(h.type=="image"){if(i.offsetX!=undefined){g.clk_x=i.offsetX;g.clk_y=i.offsetY}else{if(typeof b.fn.offset=="function"){var j=f.offset();g.clk_x=i.pageX-j.left;g.clk_y=i.pageY-j.top}else{g.clk_x=i.pageX-h.offsetLeft;g.clk_y=i.pageY-h.offsetTop}}}setTimeout(function(){g.clk=g.clk_x=g.clk_y=null},100)})};b.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};b.fn.formToArray=function(q){var p=[];if(this.length==0){return p}var d=this[0];var h=q?d.getElementsByTagName("*"):d.elements;if(!h){return p}for(var k=0,m=h.length;k<m;k++){var e=h[k];var f=e.name;if(!f){continue}if(q&&d.clk&&e.type=="image"){if(!e.disabled&&d.clk==e){p.push({name:f,value:b(e).val()});p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}continue}var r=b.fieldValue(e,true);if(r&&r.constructor==Array){for(var g=0,c=r.length;g<c;g++){p.push({name:f,value:r[g]})}}else{if(r!==null&&typeof r!="undefined"){p.push({name:f,value:r})}}}if(!q&&d.clk){var l=b(d.clk),o=l[0],f=o.name;if(f&&!o.disabled&&o.type=="image"){p.push({name:f,value:l.val()});p.push({name:f+".x",value:d.clk_x},{name:f+".y",value:d.clk_y})}}return p};b.fn.formSerialize=function(c){return b.param(this.formToArray(c))};b.fn.fieldSerialize=function(d){var c=[];this.each(function(){var h=this.name;if(!h){return}var f=b.fieldValue(this,d);if(f&&f.constructor==Array){for(var g=0,e=f.length;g<e;g++){c.push({name:h,value:f[g]})}}else{if(f!==null&&typeof f!="undefined"){c.push({name:this.name,value:f})}}});return b.param(c)};b.fn.fieldValue=function(h){for(var g=[],e=0,c=this.length;e<c;e++){var f=this[e];var d=b.fieldValue(f,h);if(d===null||typeof d=="undefined"||(d.constructor==Array&&!d.length)){continue}d.constructor==Array?b.merge(g,d):g.push(d)}return g};b.fieldValue=function(c,j){var e=c.name,p=c.type,q=c.tagName.toLowerCase();if(typeof j=="undefined"){j=true}if(j&&(!e||c.disabled||p=="reset"||p=="button"||(p=="checkbox"||p=="radio")&&!c.checked||(p=="submit"||p=="image")&&c.form&&c.form.clk!=c||q=="select"&&c.selectedIndex==-1)){return null}if(q=="select"){var k=c.selectedIndex;if(k<0){return null}var m=[],d=c.options;var g=(p=="select-one");var l=(g?k+1:d.length);for(var f=(g?k:0);f<l;f++){var h=d[f];if(h.selected){var o=h.value;if(!o){o=(h.attributes&&h.attributes.value&&!(h.attributes.value.specified))?h.text:h.value}if(g){return o}m.push(o)}}return m}return c.value};b.fn.clearForm=function(){return this.each(function(){b("input,select,textarea",this).clearFields()})};b.fn.clearFields=b.fn.clearInputs=function(){return this.each(function(){var d=this.type,c=this.tagName.toLowerCase();if(d=="text"||d=="password"||c=="textarea"){this.value=""}else{if(d=="checkbox"||d=="radio"){this.checked=false}else{if(c=="select"){this.selectedIndex=-1}}}})};b.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};b.fn.enable=function(c){if(c==undefined){c=true}return this.each(function(){this.disabled=!c})};b.fn.selected=function(c){if(c==undefined){c=true}return this.each(function(){var d=this.type;if(d=="checkbox"||d=="radio"){this.checked=c}else{if(this.tagName.toLowerCase()=="option"){var e=b(this).parent("select");if(c&&e[0]&&e[0].type=="select-one"){e.find("option").selected(false)}this.selected=c}}})};function a(){if(b.fn.ajaxSubmit.debug){var c="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(c)}else{if(window.opera&&window.opera.postError){window.opera.postError(c)}}}}})(jQuery);
	
		
/*
 * jQuery validation plug-in 1.7
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jorn Zaefferer
 *
 * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend(true,{},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"ep",validClass:"valid",errorElement:"p",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode);},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator"),eventType="on"+event.type.replace(/^validate/,"");validator.settings[eventType]&&validator.settings[eventType].call(validator,this[0]);}$(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",delegate).validateDelegate(":radio, :checkbox, select, option","click",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin");}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name;});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages;}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){if(!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){this.addEventListener(original,handler,true);},teardown:function(){this.removeEventListener(original,handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};function handler(e){e=$.event.fix(e);e.type=fix;return $.event.handle.call(this,e);}});};$.extend($.fn,{validateDelegate:function(delegate,type,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});}});})(jQuery);


/* Jump to the Link Anchor */
jQuery.fn.anchorAnimate=function(a){a=jQuery.extend({speed:1000},a);return this.each(function(){var b=this;$j(b).click(function(e){e.preventDefault();var d=window.location.href;var f=$j(b).attr("href");var c=$j(f).offset().top;$j("html:not(:animated),body:not(:animated)").animate({scrollTop:c},a.speed,function(){window.location.hash=f});return false})})};


// Popupwindow is using the MIT license.
jQuery.fn.popupwindow=function(b){var a=b||{};return this.each(function(g){var j,k,e,d,f,c;e=(jQuery(this).attr("rel")||"").split(",");j={height:600,width:600,toolbar:0,scrollbars:0,status:0,resizable:1,left:0,top:0,center:0,createnew:1,location:0,menubar:0,onUnload:null};if(e.length==1&&e[0].split(":").length==1){f=e[0];if(typeof a[f]!="undefined"){j=jQuery.extend(j,a[f])}}else{for(var h=0;h<e.length;h++){d=e[h].split(":");if(typeof j[d[0]]!="undefined"&&d.length==2){j[d[0]]=d[1]}}}if(j.center==1){j.top=(screen.height-(j.height+110))/2;j.left=(screen.width-j.width)/2}k="location="+j.location+",menubar="+j.menubar+",height="+j.height+",width="+j.width+",toolbar="+j.toolbar+",scrollbars="+j.scrollbars+",status="+j.status+",resizable="+j.resizable+",left="+j.left+",screenX="+j.left+",top="+j.top+",screenY="+j.top;jQuery(this).bind("click",function(){var i=j.createnew?"PopUpWindow"+g:"PopUpWindow";c=window.open(this.href,i,k);if(j.onUnload){unloadInterval=setInterval(function(){if(!c||c.closed){clearInterval(unloadInterval);j.onUnload.call($(this))}},500)}c.focus();return false})})};


/*
 * jQuery Autocomplete plugin 1.1
 *
 * Copyright (c) 2009 Jorn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
 */
( function($) {
	$.fn.extend( {
		autocomplete : function(urlOrData, options) {
			var isUrl = typeof urlOrData == "string";
			options = $.extend( {}, $.Autocompleter.defaults, {
				url :isUrl ? urlOrData : null,
				data :isUrl ? null : urlOrData,
				delay :isUrl ? $.Autocompleter.defaults.delay : 10,
				max :options && !options.scroll ? 10 : 150
			}, options);
			options.highlight = options.highlight || function(value) {
				return value;
			};
			options.formatMatch = options.formatMatch || options.formatItem;
			return this.each( function() {
				new $.Autocompleter(this, options);
			});
		},
		result : function(handler) {
			return this.bind("result", handler);
		},
		search : function(handler) {
			return this.trigger("search", [ handler ]);
		},
		flushCache : function() {
			return this.trigger("flushCache");
		},
		setOptions : function(options) {
			return this.trigger("setOptions", [ options ]);
		},
		unautocomplete : function() {
			return this.trigger("unautocomplete");
		}
	});
	$.Autocompleter = function(input, options) {
		var KEY = {
			UP :38,
			DOWN :40,
			DEL :46,
			TAB :9,
			RETURN :13,
			ESC :27,
			COMMA :188,
			PAGEUP :33,
			PAGEDOWN :34,
			BACKSPACE :8
		};
		var $input = $(input).attr("autocomplete", "off").addClass(
				options.inputClass);
		var timeout;
		var previousValue = "";
		var cache = $.Autocompleter.Cache(options);
		var hasFocus = 0;
		var lastKeyPressCode;
		var config = {
			mouseDownOnSelect :false
		};
		var select = $.Autocompleter.Select(options, input, selectCurrent,
				config);
		var blockSubmit;
		$.browser.opera
				&& $(input.form).bind("submit.autocomplete", function() {
					if (blockSubmit) {
						blockSubmit = false;
						return false;
					}
				});
		$input.bind(
				($.browser.opera ? "keypress" : "keydown") + ".autocomplete",
				function(event) {
					hasFocus = 1;
					lastKeyPressCode = event.keyCode;
					switch (event.keyCode) {
					case KEY.UP:
						event.preventDefault();
						try {
							if (select.visible()) {
								select.prev();
							} else {
								onChange(0, true);
							}
						} catch (err) {}
						break;
					case KEY.DOWN:
						event.preventDefault();
						try {
							if (select.visible()) {
								select.next();
							} else {
								onChange(0, true);
							}
						} catch (err) {}
						break;
					case KEY.PAGEUP:
						event.preventDefault();
						if (select.visible()) {
							select.pageUp();
						} else {
							onChange(0, true);
						}
						break;
					case KEY.PAGEDOWN:
						event.preventDefault();
						if (select.visible()) {
							select.pageDown();
						} else {
							onChange(0, true);
						}
						break;
					case options.multiple
							&& $.trim(options.multipleSeparator) == ","
							&& KEY.COMMA:
//					case KEY.TAB:
					case KEY.RETURN:
						if (selectCurrent()) {
							event.preventDefault();
							blockSubmit = false;
							return false;
						}
						break;
					case KEY.ESC:
						select.hide();
						break;
					default:
						clearTimeout(timeout);
						timeout = setTimeout(onChange, options.delay);
						break;
					}
				}).focus( function() {
			hasFocus++;
		}).blur( function() {
			hasFocus = 0;
			if (!config.mouseDownOnSelect) {
				hideResults();
			}
		}).click( function() {
			if (hasFocus++ > 1 && !select.visible()) {
				onChange(0, true);
			}
		}).bind(
				"search",
				function() {
					var fn = (arguments.length > 1) ? arguments[1] : null;
					function findValueCallback(q, data) {
						var result;
						if (data && data.length) {
							for ( var i = 0; i < data.length; i++) {
								if (data[i].result.toLowerCase() == q
										.toLowerCase()) {
									result = data[i];
									break;
								}
							}
						}
						if (typeof fn == "function")
							fn(result);
						else
							$input.trigger("result", result
									&& [ result.data, result.value ]);
					}
					$.each(trimWords($input.val()), function(i, value) {
						request(value, findValueCallback, findValueCallback);
					});
				}).bind("flushCache", function() {
			cache.flush();
		}).bind("setOptions", function() {
			$.extend(options, arguments[1]);
			if ("data" in arguments[1])
				cache.populate();
		}).bind("unautocomplete", function() {
			select.unbind();
			$input.unbind();
			$(input.form).unbind(".autocomplete");
		});
		function selectCurrent() {
			var selected = select.selected();
			
			if (!selected)
				return false;
			var v = selected.result;
			previousValue = v;
			if (options.multiple) {
				var words = trimWords($input.val());
				if (words.length > 1) {
					var seperator = options.multipleSeparator.length;
					var cursorAt = $(input).selection().start;
					var wordAt, progress = 0;
					$.each(words, function(i, word) {
						progress += word.length;
						if (cursorAt <= progress) {
							wordAt = i;
							return false;
						}
						progress += seperator;
					});
					words[wordAt] = v;
					v = words.join(options.multipleSeparator);
				}
				v += options.multipleSeparator;
			}
			$input.val(v);
			hideResultsNow();
			$input.trigger("result", [ selected.data, selected.value ]);
			return true;
		}
		function onChange(crap, skipPrevCheck) {
			if (lastKeyPressCode == KEY.DEL) {
				select.hide();
				return;
			}
			var currentValue = $input.val();
			if (!skipPrevCheck && currentValue == previousValue)
				return;
			previousValue = currentValue;
			currentValue = lastWord(currentValue);
			if (currentValue.length >= options.minChars) {
				$input.addClass(options.loadingClass);
				if (!options.matchCase)
					currentValue = currentValue.toLowerCase();
				request(currentValue, receiveData, hideResultsNow);
			} else {
				stopLoading();
				select.hide();
			}
		}
		;
		function trimWords(value) {
			if (!value)
				return [ "" ];
			if (!options.multiple)
				return [ $.trim(value) ];
			return $.map(value.split(options.multipleSeparator),
					function(word) {
						return $.trim(value).length ? $.trim(word) : null;
					});
		}
		function lastWord(value) {
			if (!options.multiple)
				return value;
			var words = trimWords(value);
			if (words.length == 1)
				return words[0];
			var cursorAt = $(input).selection().start;
			if (cursorAt == value.length) {
				words = trimWords(value)
			} else {
				words = trimWords(value.replace(value.substring(cursorAt), ""));
			}
			return words[words.length - 1];
		}
		function autoFill(q, sValue) {
			if (options.autoFill
					&& (lastWord($input.val()).toLowerCase() == q.toLowerCase())
					&& lastKeyPressCode != KEY.BACKSPACE) {
				$input.val($input.val()
						+ sValue.substring(lastWord(previousValue).length));
				$(input).selection(previousValue.length,
						previousValue.length + sValue.length);
			}
		}
		;
		
		function hideResults() {
			clearTimeout(timeout);
			timeout = setTimeout(hideResultsNow, 200);
		}
		;
		function hideResultsNow() {
			var wasVisible = select.visible();
			select.hide();
			clearTimeout(timeout);
			stopLoading();
			if (options.mustMatch) {
				$input.search( function(result) {
					if (!result) {
						if (options.multiple) {
							var words = trimWords($input.val()).slice(0, -1);
							$input.val(words.join(options.multipleSeparator)
									+ (words.length ? options.multipleSeparator
											: ""));
						} else {
							$input.val("");
							$input.trigger("result", null);
						}
					}
				});
			}
		}
		;
		function receiveData(q, data) {
			if (data && data.length && hasFocus) {
				stopLoading();
				select.display(data, q);
				autoFill(q, data[0].value);
				select.show();
			} else {
				hideResultsNow();
			}
		}
		;
		function request(term, success, failure) {
			if (!options.matchCase)
				term = term.toLowerCase();
			//var data = cache.load(term);
			//if (data && data.length) {
			//	success(term, data);
			//} else 
			if ((typeof options.url == "string")
					&& (options.url.length > 0)) {
				var extraParams = {
					timestamp :+new Date()
				};
				$.each(options.extraParams, function(key, param) {
					extraParams[key] = typeof param == "function" ? param()
							: param;
				});
				$.ajax( {
					mode :"abort",
					port :"autocomplete" + input.name,
					dataType :options.dataType,
					url :options.url,
					data :$.extend( {
						q :lastWord(term),
						limit :options.max
					}, extraParams),
					success : function(data) {
						var parsed = options.parse && options.parse(data)
								|| parse(data);
						//cache.add(term, parsed);
						//console.log(11111111111);
						success(term, parsed);
					}, error: function(response, error) {
						select.emptyList();
						failure(term);
					}
				});
			} else {
				select.emptyList();
				failure(term);
			}
		}
		;
		function parse(data) {
			var parsed = [];
			var rows = data.split("\n");
			for ( var i = 0; i < rows.length; i++) {
				var row = $.trim(rows[i]);
				if (row) {
					row = row.split("|");
					parsed[parsed.length] = {
						data :row,
						value :row[0],
						result :options.formatResult
								&& options.formatResult(row, row[0]) || row[0]
					};
				}
			}
			return parsed;
		}
		;
		function stopLoading() {
			$input.removeClass(options.loadingClass);
		}
		;
	};
	$.Autocompleter.defaults = {
		inputClass :"ac_input",
		resultsClass :"ac_results",
		loadingClass :"ac_loading",
		minChars :1,
		delay :400,
		matchCase :false,
		matchSubset :true,
		matchContains :false,
		cacheLength :10,
		max :100,
		mustMatch :false,
		extraParams : {},
		selectFirst :true,
		formatItem : function(row) {
			return row[0];
		},
		formatMatch :null,
		autoFill :false,
		width :0,
		multiple :false,
		multipleSeparator :", ",
		highlight : function(value, term) {
			return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("
					+ term
							.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,
									"\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"),
					"$1");
		},
		scroll :true,
		scrollHeight :180
	};
	$.Autocompleter.Cache = function(options) {
		var data = {};
		var length = 0;
		function matchSubset(s, sub) {
			if (!options.matchCase)
				s = s.toLowerCase();
			var i = s.indexOf(sub);
			if (options.matchContains == "word") {
				i = s.toLowerCase().search("\\b" + sub.toLowerCase());
			}
			if (i == -1)
				return false;
			return i == 0 || options.matchContains;
		}
		;
		function add(q, value) {
			if (length > options.cacheLength) {
				flush();
			}
			if (!data[q]) {
				length++;
			}
			data[q] = value;
		}
		function populate() {
			if (!options.data)
				return false;
			var stMatchSets = {}, nullData = 0;
			if (!options.url)
				options.cacheLength = 1;
			stMatchSets[""] = [];
			for ( var i = 0, ol = options.data.length; i < ol; i++) {
				var rawValue = options.data[i];
				rawValue = (typeof rawValue == "string") ? [ rawValue ]
						: rawValue;
				var value = options.formatMatch(rawValue, i + 1,
						options.data.length);
				if (value === false)
					continue;
				var firstChar = value.charAt(0).toLowerCase();
				if (!stMatchSets[firstChar])
					stMatchSets[firstChar] = [];
				var row = {
					value :value,
					data :rawValue,
					result :options.formatResult
							&& options.formatResult(rawValue) || value
				};
				stMatchSets[firstChar].push(row);
				if (nullData++ < options.max) {
					stMatchSets[""].push(row);
				}
			}
			;
			$.each(stMatchSets, function(i, value) {
				options.cacheLength++;
				add(i, value);
			});
		}
		setTimeout(populate, 25);
		function flush() {
			data = {};
			length = 0;
		}
		return {
			flush :flush,
			add :add,
			populate :populate,
			load : function(q) {
				if (!options.cacheLength || !length)
					return null;
				if (!options.url && options.matchContains) {
					var csub = [];
					for ( var k in data) {
						if (k.length > 0) {
							var c = data[k];
							$.each(c, function(i, x) {
								if (matchSubset(x.value, q)) {
									csub.push(x);
								}
							});
						}
					}
					return csub;
				} else if (data[q]) {
					return data[q];
				} else if (options.matchSubset) {
					for ( var i = q.length - 1; i >= options.minChars; i--) {
						var c = data[q.substr(0, i)];
						if (c) {
							var csub = [];
							$.each(c, function(i, x) {
								if (matchSubset(x.value, q)) {
									csub[csub.length] = x;
								}
							});
							return csub;
						}
					}
				}
				return null;
			}
		};
	};
	$.Autocompleter.Select = function(options, input, select, config) {
		var CLASSES = {
			ACTIVE :"ac_over"
		};
		var listItems, active = -1, data, term = "", needsInit = true, element, list;
		function init() {
			if (!needsInit)
				return;
			list = $("<div/>").hide().addClass(options.resultsClass).css(
					"position", "absolute").appendTo(document.body);
			list.attr("id","search-drop f_small"); //added by lanian 2010.07.02 autoComplete re-designed
			list .mouseover(
							function(event) {
								if (target(event).nodeName
										&& target(event).nodeName.toUpperCase() == 'LI') {
									active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
									$(target(event)).addClass(CLASSES.ACTIVE);
								}
							}).click( function(event) {
						$(target(event)).addClass(CLASSES.ACTIVE);
						/* 검색로그 관련 input method 추가.04-30*/
						document.globalSearch.qlInputMethod.value="ac";						
						select();
						input.focus();
						return false;
					}).mousedown( function() {
						config.mouseDownOnSelect = true;
					}).mouseup( function() {
						config.mouseDownOnSelect = false;
					});
			if (options.width > 0)
//				list.css("width", options.width);
			needsInit = false;
		}
		function target(event) {
			var eventElement = event.target;
			while (eventElement && eventElement.tagName != "LI")
				eventElement = eventElement.parentNode;
			if (!eventElement)
				return [];
			return eventElement;
		}
		function moveSelect(step) {
			listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
			movePosition(step);
			var activeItem = listItems.slice(active, active + 1).addClass(
					CLASSES.ACTIVE);
			if (options.scroll) {
				var offset = 0;
				listItems.slice(0, active).each( function() {
					offset += this.offsetHeight;
				});
				if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
					list.scrollTop(offset + activeItem[0].offsetHeight
							- list.innerHeight());
				} else if (offset < list.scrollTop()) {
					list.scrollTop(offset);
				}
			}
		}
		;
		function movePosition(step) {
			active += step;
			if (active < 0) {
				active = listItems.size() - 1;
			} else if (active >= listItems.size()) {
				active = 0;
			}
		}
		function limitNumberOfItems(available) {
			return options.max && options.max < available ? options.max
					: available;
		}
		function fillList() {
			list.empty();
			var max = limitNumberOfItems(data.length);
			for ( var i = 0; i < max; i++) {
				if (!data[i])
					continue;
				var products = options.formatItem(data[i].data, i + 1, max, data[i].value, term);
				if (products === false)
					continue;
				
				var dl = $("<li/>");
				
				if( i == 0 ) dl.addClass("first");
				
				var image = options.image(products.img);
				var dt    = $("<dt/>").append(image).appendTo(dl);
				/*
				if ( !image.complete ) {
					image.src = $j("#staticMarketingImageURL").val() + "/common/images/tmp/@samsung.gif";
				}
				*/
				//image.attr("onerror","this.src='"+ $j("#staticMarketingImageURL").val() +"/common/images/tmp/@samsung.gif'"); 				
				var rating  = $(options.rating(products.rating));				
				var content = options.highlight("<em>" + products.productNm + "</em>", term) + "" + products.categoryNm + "";
				var dd      = $("<a/>").html(content).append(rating).appendTo(dl);
				
				if(i==0){				
					var list1 = $('<ul/>').appendTo(list)[0];
					}
				//	dl.appendTo(list1)[0]
				//	dl.data("ac_data",data[i]);
				dl.addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list1)[0];
				dl.data("ac_data",data[i]);
			}
			
			listItems = list.find("li");
			if (options.selectFirst) {
				listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
				active = 0;
			}
			if ($.fn.bgiframe)
				list.bgiframe();
		}
		return {
			display : function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next : function() {
			moveSelect(1);
		},
		prev : function() {
			moveSelect(-1);
		},
		pageUp : function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect(-active);
			} else {
				moveSelect(-8);
			}
		},
		pageDown : function() {
			if (active != listItems.size() - 1
					&& active + 8 > listItems.size()) {
				moveSelect(listItems.size() - 1 - active);
			} else {
				moveSelect(8);
			}
		},
		hide : function() {
			list && list.hide();
			listItems && listItems.removeClass(CLASSES.ACTIVE);
			active = -1;
		},
		visible : function() {
			return list && list.is(":visible");
		},
		current : function() {
			return this.visible()
					&& (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst
							&& listItems[0]);
		},
		show : function() {
			var offset = $(input).offset();
			list.css(
					{
//						width :typeof options.width == "string"
//								|| options.width > 0 ? options.width : $(
//								input).width(),
						top : options.heightOffset ? options.heightOffset(offset.top, input.offsetHeight) : offset.top + input.offsetHeight,
						left :options.widthOffset ? options.widthOffset(offset.top, offset.left) : offset.left
					}).show();
			if (options.scroll) {
				list.scrollTop(0);
				list.css( {
					maxHeight :options.scrollHeight,
					overflow :'auto'
				});
				if ($.browser.msie
						&& typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each( function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
					list.css('height',
							scrollbarsVisible ? options.scrollHeight
									: listHeight);
					if (!scrollbarsVisible) {
						var width1 = list.width()
						- parseInt(listItems.css("padding-left"))
						- parseInt(listItems.css("padding-right"));
						listItems.width("200");
					}
				}
			}
		},
		selected : function() {
			var selected = listItems
					&& listItems.filter("." + CLASSES.ACTIVE).removeClass(
							CLASSES.ACTIVE);
			return selected && selected.length && selected.data("ac_data");
		},
		emptyList : function() {
			list && list.empty();
		},
		unbind : function() {
			list && list.remove();
		}
	};
};
$.fn.selection = function(start, end) {
	if (start !== undefined) {
		return this.each( function() {
			if (this.createTextRange) {
				var selRange = this.createTextRange();
				if (end === undefined || start == end) {
					selRange.move("character", start);
					selRange.select();
				} else {
					selRange.collapse(true);
					selRange.moveStart("character", start);
					selRange.moveEnd("character", end);
					selRange.select();
				}
			} else if (this.setSelectionRange) {
				this.setSelectionRange(start, end);
			} else if (this.selectionStart) {
				this.selectionStart = start;
				this.selectionEnd = end;
			}
		});
	}
	var field = this[0];
	if (field.createTextRange) {
		var range = document.selection.createRange(), orig = field.value, teststring = "<->", textLength = range.text.length;
		range.text = teststring;
		var caretAt = field.value.indexOf(teststring);
		field.value = orig;
		this.selection(caretAt, caretAt + textLength);
		return {
			start :caretAt,
			end :caretAt + textLength
		}
	} else if (field.selectionStart !== undefined) {
		return {
			start :field.selectionStart,
			end :field.selectionEnd
		}
	}
};
})(jQuery);

/*
* Use Global Search
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jorn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
( function($) {
$.fn.extend( {
	globalautocomplete : function(urlOrData, options) {
		var isUrl = typeof urlOrData == "string";
		options = $.extend( {}, $.Autocompleter.defaults, {
			url :isUrl ? urlOrData : null,
			data :isUrl ? null : urlOrData,
			delay :isUrl ? $.Autocompleter.defaults.delay : 10,
			max :options && !options.scroll ? 10 : 150
		}, options);
		options.highlight = options.highlight || function(value) {
			return value;
		};
		options.formatMatch = options.formatMatch || options.formatItem;
		return this.each( function() {
			new $.Autocompleter2(this, options);
		});
	},
	result : function(handler) {
		return this.bind("result", handler);
	},
	search : function(handler) {
		return this.trigger("search", [ handler ]);
	},
	flushCache : function() {
		return this.trigger("flushCache");
	},
	setOptions : function(options) {
		return this.trigger("setOptions", [ options ]);
	},
	unautocomplete : function() {
		return this.trigger("unautocomplete");
	}
});
$.Autocompleter2 = function(input, options) {
	var KEY = {
		UP :38,
		DOWN :40,
		DEL :46,
		TAB :9,
		RETURN :13,
		ESC :27,
		COMMA :188,
		PAGEUP :33,
		PAGEDOWN :34,
		BACKSPACE :8
	};
	var $input = $(input).attr("autocomplete", "off").addClass(
			options.inputClass);
	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect :false
	};
	var select = $.Autocompleter2.Select(options, input, selectCurrent,
			config);
	var blockSubmit;
	$.browser.opera
			&& $(input.form).bind("submit.autocomplete", function() {
				if (blockSubmit) {
					blockSubmit = false;
					return false;
				}
			});
	$input.bind(
			($.browser.opera ? "keypress" : "keydown") + ".autocomplete",
			function(event) {
				hasFocus = 1;
				lastKeyPressCode = event.keyCode;
				switch (event.keyCode) {
				case KEY.UP:
					event.preventDefault();
					try {
						if (select.visible()) {
							select.prev();
							selectCurrent_1();
						} else {
							onChange(0, true);
						}
					} catch (err) {}
					break;
				case KEY.DOWN:
//					console.log('keydown2');
					event.preventDefault();
					try {
						if (select.visible()) {
							select.next();
							selectCurrent_1();
						} else {
							onChange(0, true);
						}
					} catch (err) {}
					break;
				case KEY.PAGEUP:
					event.preventDefault();
					if (select.visible()) {
						select.pageUp();
						selectCurrent_1();
					} else {
						onChange(0, true);
					}
					break;
				case KEY.PAGEDOWN:
					event.preventDefault();
					if (select.visible()) {
						select.pageDown();
						selectCurrent_1();
					} else {
						onChange(0, true);
					}
					break;
				case options.multiple
						&& $.trim(options.multipleSeparator) == ","
						&& KEY.COMMA:
//				case KEY.TAB:
				case KEY.RETURN:
//					console.log('key.return');
					//Keyword & Enter 공백 처리					
					var topSearchWord = trim($('#topSearch').val());					
					if(topSearchWord =='' ||  topSearchWord == null || $('#topSearch').val() == 'Search Apps'){	
						return false;
					}else{
						/* 검색로그 관련 input method 추가.04-30*/
						document.globalSearch.qlInputMethod.value="ac";
						////select.hide(); // hiake 웹접근성에서 엔터키를 쳤을때 
//						document.globalSearch.submit();						
						if (selectCurrent()) {
							event.preventDefault();
							blockSubmit = true;
							return false;
						}
					}
					


					break;
				case KEY.ESC:
					select.hide();
					break;
				default:
					clearTimeout(timeout);
					timeout = setTimeout(onChange, options.delay);
					break;
				}
			}).focus( function() {
		hasFocus++;
	}).blur( function() {
		hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click( function() {
		if (hasFocus++ > 1 && !select.visible()) {
			onChange(0, true);
		}
	}).bind(
			"search",
			function() {
				var fn = (arguments.length > 1) ? arguments[1] : null;
				function findValueCallback(q, data) {
					var result;
					if (data && data.length) {
						for ( var i = 0; i < data.length; i++) {
							if (data[i].result.toLowerCase() == q
									.toLowerCase()) {
								result = data[i];
								break;
							}
						}
					}
					if (typeof fn == "function")
						fn(result);
					else
						$input.trigger("result", result
								&& [ result.data, result.value ]);
				}
				$.each(trimWords($input.val()), function(i, value) {
					request(value, findValueCallback, findValueCallback);
				});
			}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(options, arguments[1]);
		if ("data" in arguments[1])
			cache.populate();
	}).bind("unautocomplete", function() {
		select.unbind();
		$input.unbind();
		$(input.form).unbind(".autocomplete");
	});
	function selectCurrent() {
		var selected = select.selected();
		
		if (!selected)
			return false;
		var v = selected.result;
		previousValue = v;
		if (options.multiple) {
			var words = trimWords($input.val());
			if (words.length > 1) {
				var seperator = options.multipleSeparator.length;
				var cursorAt = $(input).selection().start;
				var wordAt, progress = 0;
				$.each(words, function(i, word) {
					progress += word.length;
					if (cursorAt <= progress) {
						wordAt = i;
						return false;
					}
					progress += seperator;
				});
				words[wordAt] = v;
				v = words.join(options.multipleSeparator);
			}
			v += options.multipleSeparator;
		}
		$input.val(v);
		hideResultsNow();
		$input.trigger("result", [ selected.data, selected.value ]);			
		return true;
	}
	function selectCurrent_1() {
		
		var selected = select.selected_1();
		/**
		if (!selected)
			return false;
		**/
		var v = selected.result;
		previousValue = v;
		if (options.multiple) {
			var words = trimWords($input.val());
			if (words.length > 1) {
				var seperator = options.multipleSeparator.length;
				var cursorAt = $(input).selection().start;
				var wordAt, progress = 0;
				$.each(words, function(i, word) {
					progress += word.length;
					if (cursorAt <= progress) {
						wordAt = i;
						return false;
					}
					progress += seperator;
				});
				words[wordAt] = v;
				v = words.join(options.multipleSeparator);
			}
			v += options.multipleSeparator;
		}
		$input.val(v);
		
		/**
		hideResultsNow();
		$input.trigger("result", [ selected.data, selected.value ]);
		return true;
		**/
	}
	function onChange(crap, skipPrevCheck) {
		if (lastKeyPressCode == KEY.DEL) {
			select.hide();
			return;
		}
		var currentValue = $input.val();
		if (!skipPrevCheck && currentValue == previousValue)
			return;
		previousValue = currentValue;
		currentValue = lastWord(currentValue);
		if (currentValue.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	}
	;
	function trimWords(value) {
		if (!value)
			return [ "" ];
		if (!options.multiple)
			return [ $.trim(value) ];
		return $.map(value.split(options.multipleSeparator),
				function(word) {
					return $.trim(value).length ? $.trim(word) : null;
				});
	}
	function lastWord(value) {
		if (!options.multiple)
			return value;
		var words = trimWords(value);
		if (words.length == 1)
			return words[0];
		var cursorAt = $(input).selection().start;
		if (cursorAt == value.length) {
			words = trimWords(value)
		} else {
			words = trimWords(value.replace(value.substring(cursorAt), ""));
		}
		return words[words.length - 1];
	}
	function autoFill(q, sValue) {
		if (options.autoFill
				&& (lastWord($input.val()).toLowerCase() == q.toLowerCase())
				&& lastKeyPressCode != KEY.BACKSPACE) {
			$input.val($input.val()
					+ sValue.substring(lastWord(previousValue).length));
			$(input).selection(previousValue.length,
					previousValue.length + sValue.length);
		}
	}
	;
	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	}
	;
	function hideResultsNow() {
		var wasVisible = select.visible();
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			$input.search( function(result) {
				if (!result) {
					if (options.multiple) {
						var words = trimWords($input.val()).slice(0, -1);
						$input.val(words.join(options.multipleSeparator)
								+ (words.length ? options.multipleSeparator
										: ""));
					} else {
						$input.val("");
						$input.trigger("result", null);
					}
				}
			});
		}
	}
	;
	function receiveData(q, data) {
		if (data && data.length && hasFocus) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	}
	;
	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		//var data = cache.load(term);
		//if (data && data.length) {
		//	success(term, data);
		//} else 
		if ((typeof options.url == "string")
				&& (options.url.length > 0)) {
			var extraParams = {
				timestamp :+new Date()
			};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param()
						: param;
			});
			$.ajax( {
				mode :"abort",
				port :"autocomplete" + input.name,
				dataType :options.dataType,
				url :options.url,
				data :$.extend( {
					q :lastWord(term),
					limit :options.max
				}, extraParams),
				success : function(data) {
					var parsed = options.parse && options.parse(data)
							|| parse(data);
					//cache.add(term, parsed);
					//console.log(22222222222);
					success(term, parsed);
				}, error: function(response, error) {
					select.emptyList();
					failure(term);
				}				
			});
		} else {
			select.emptyList();
			failure(term);
		}
	}
	;
	function parse(data) {
		var parsed = [];
		var rows = data.split("\n");
		for ( var i = 0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				row = row.split("|");
				parsed[parsed.length] = {
					data :row,
					value :row[0],
					result :options.formatResult
							&& options.formatResult(row, row[0]) || row[0]
				};
			}
		}
		return parsed;
	}
	;
	function stopLoading() {
		$input.removeClass(options.loadingClass);
	}
	;
};
$.Autocompleter.defaults = {
	inputClass :"ac_input",
	resultsClass :"ac_results",
	loadingClass :"ac_loading",
	minChars :1,
	delay :400,
	matchCase :false,
	matchSubset :true,
	matchContains :false,
	cacheLength :10,
	max :100,
	mustMatch :false,
	extraParams : {},
	selectFirst :false,
	formatItem : function(row) {
		return row[0];
	},
	formatMatch :null,
	autoFill :false,
	width :0,
	multiple :false,
	multipleSeparator :", ",
	highlight : function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("
				+ term
						.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,
								"\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"),
				"$1");
	},
	scroll :true,
	scrollHeight :180
};
$.Autocompleter.Cache = function(options) {
	var data = {};
	var length = 0;
	function matchSubset(s, sub) {
		if (!options.matchCase)
			s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (options.matchContains == "word") {
			i = s.toLowerCase().search("\\b" + sub.toLowerCase());
		}
		if (i == -1)
			return false;
		return i == 0 || options.matchContains;
	}
	;
	function add(q, value) {
		if (length > options.cacheLength) {
			flush();
		}
		if (!data[q]) {
			length++;
		}
		data[q] = value;
	}
	function populate() {
		if (!options.data)
			return false;
		var stMatchSets = {}, nullData = 0;
		if (!options.url)
			options.cacheLength = 1;
		stMatchSets[""] = [];
		for ( var i = 0, ol = options.data.length; i < ol; i++) {
			var rawValue = options.data[i];
			rawValue = (typeof rawValue == "string") ? [ rawValue ]
					: rawValue;
			var value = options.formatMatch(rawValue, i + 1,
					options.data.length);
			if (value === false)
				continue;
			var firstChar = value.charAt(0).toLowerCase();
			if (!stMatchSets[firstChar])
				stMatchSets[firstChar] = [];
			var row = {
				value :value,
				data :rawValue,
				result :options.formatResult
						&& options.formatResult(rawValue) || value
			};
			stMatchSets[firstChar].push(row);
			if (nullData++ < options.max) {
				stMatchSets[""].push(row);
			}
		}
		;
		$.each(stMatchSets, function(i, value) {
			options.cacheLength++;
			add(i, value);
		});
	}
	setTimeout(populate, 25);
	function flush() {
		data = {};
		length = 0;
	}
	return {
		flush :flush,
		add :add,
		populate :populate,
		load : function(q) {
			if (!options.cacheLength || !length)
				return null;
			if (!options.url && options.matchContains) {
				var csub = [];
				for ( var k in data) {
					if (k.length > 0) {
						var c = data[k];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}
				return csub;
			} else if (data[q]) {
				return data[q];
			} else if (options.matchSubset) {
				for ( var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};
	$.Autocompleter2.Select = function(options, input, select, config) {
		var CLASSES = {
			ACTIVE :"ac_over"
		};
		var listItems, active = -1, data, term = "", needsInit = true, element, list;
		
		function init() {
			if (!needsInit)
				return;
				list = $("<div/>").hide().addClass(options.resultsClass).css(
						"position", "absolute").appendTo(document.body);
				 try {
					if(Global_ARCOUNTRY == "true"){
						list.attr("class","search-drop f_small_ae"); //use global search
					}else{
						list.attr("class","search-drop f_small"); //use global search
					}
				} catch (err){list.attr("class","search-drop f_small");} //use global search}
				list .mouseover(
								function(event) {
									if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
										active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
										$(target(event)).addClass(CLASSES.ACTIVE);
									}
								}).click( function(event) {
							$(target(event)).addClass(CLASSES.ACTIVE);
							/* 검색로그 관련 input method 추가.04-30*/
							document.globalSearch.qlInputMethod.value="ac";
							select();
							input.focus();
//							$j("#search").click();
							return false;
						}).mousedown( function() {
							config.mouseDownOnSelect = true;
						}).mouseup( function() {
							config.mouseDownOnSelect = false;
						});
				if (options.width > 0)
//					list.css("width", options.width);
				needsInit = false;
			}
			function target(event) {
				var eventElement = event.target;
				while (eventElement && eventElement.tagName != "LI")
					eventElement = eventElement.parentNode;
				if (!eventElement)
					return [];
				return eventElement;
			}
			function moveSelect(step) {
				listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
				movePosition(step);
				var activeItem = listItems.slice(active, active + 1).addClass(
						CLASSES.ACTIVE);
				if (options.scroll) {
					var offset = 0;
					listItems.slice(0, active).each( function() {
						offset += this.offsetHeight;
					});
					if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
						list.scrollTop(offset + activeItem[0].offsetHeight
								- list.innerHeight());
					} else if (offset < list.scrollTop()) {
						list.scrollTop(offset);
					}
				}
			}
			
			function movePosition(step) {
				active += step;
				if (active < 0) {
					active = listItems.size() - 1;
				} else if (active >= listItems.size()) {
					active = 0;
				}
			}
			function limitNumberOfItems(available) {
				return options.max && options.max < available ? options.max
						: available;
			}
			/* 검색어자동완성 데이터 구성하는 부분*/	
			function fillList() {
				list.empty();
				var max = limitNumberOfItems(data.length);
				for ( var i = 0; i < max; i++) {
					if (!data[i])
						continue;
					var products = options.formatItem(data[i].data, i + 1, max, data[i].value, term);
					if (products === false)
						continue;
					
					var dl = $("<li/>");
					
					//if( i == 0 ) dl.addClass("first");
					
					var image = null;
					/**
					if(products.serviceType == '2'){
						image = options.mobileImage(products.img);
					}
					else{
						image = options.image(products.img);
					}
					image.onerror = function (evt) {
						this.src = $j("#staticMarketingImageURL").val() +"/common/images/tmp/@samsung.gif";
					}
					
					var dt    = $("<dt/>").append(image).appendTo(dl);
					*/
					/*
					if ( !image.complete ) {
						image.src = $j("#staticMarketingImageURL").val() + "/common/images/tmp/@samsung.gif";
					}
					*/
					//var type = options.type(products.serviceType);
					
					//var content = options.highlight("<em>" + type + "</em>" + "<strong>" + products.productNm + "</strong>", term) + "<span>" + products.categoryNm + "</span>";
					var mkt_keyword=$j("#topSearch").val();
					var product_nm=products.productNm;
					var htmlTag="";
					/**
					if(Global_ARCOUNTRY != "true"){
						htmlTag="<span><\/span>";
					}
					**/
					if( '' != mkt_keyword){
						if('' != product_nm){
							
							product_nm =ncomAutoComplete(mkt_keyword, product_nm);
						
						}
					}
					var content = options.highlight(product_nm, term) ;
					var dd      = $("<a/>").html(content).appendTo(dl);
									
					if(i==0){				
						var list1 = $('<ul/>').appendTo(list)[0];
						}
					//	dl.appendTo(list1)[0]
					//	dl.data("ac_data",data[i]);
					dl.addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list1)[0];
					dl.data("ac_data",data[i]);
				}
				listItems = list.find("li");
				if (options.selectFirst) {
					listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
					active = 0;
				}
				if ($.fn.bgiframe)
					list.bgiframe();
			}
			return {
				display : function(d, q) {
					init();
					data = d;
					term = q;
					fillList();
				},
				next : function() {
					moveSelect(1);
				},
				prev : function() {
					moveSelect(-1);
				},
				pageUp : function() {
					if (active != 0 && active - 8 < 0) {
						moveSelect(-active);
					} else {
						moveSelect(-8);
					}
				},
				pageDown : function() {
					if (active != listItems.size() - 1
							&& active + 8 > listItems.size()) {
						moveSelect(listItems.size() - 1 - active);
					} else {
						moveSelect(8);
					}
				},
				hide : function() {
					list && list.hide();
					listItems && listItems.removeClass(CLASSES.ACTIVE);
					active = -1;
				},
				visible : function() {
					return list && list.is(":visible");
				},
				current : function() {
					return this.visible()
							&& (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst
									&& listItems[0]);
				},
				show : function() {
					var offset = $(input).offset();
					if(Global_ARCOUNTRY == "true"){
						list.css(
								{
//									width :typeof options.width == "string"
//											|| options.width > 0 ? options.width : $(
//											input).width(),
									
									top : options.heightOffset ? (options.heightOffset(offset.top, input.offsetHeight))+9.5 : (offset.top + input.offsetHeight)+9.5,
									left :options.widthOffset ? (options.widthOffset(offset.top, offset.left))+3.5 : (offset.left)+3.5,
									"margin-left" : "-10px",
									"*margin-right" : "19px"
								}).show();
					}else{
						list.css(
								{
		//							width :typeof options.width == "string"
		//									|| options.width > 0 ? options.width : $(
		//									input).width(),
									/*자동완성 위치 조정 부분
									 * hiake
									 * */
									top : options.heightOffset ? (options.heightOffset(offset.top, input.offsetHeight))+10 : (offset.top + input.offsetHeight)+10,
									left :options.widthOffset ? (options.widthOffset(offset.top, offset.left))+4 : (offset.left)+4
								}).show();
					}
					if (options.scroll) {
						list.scrollTop(0);
						list.css( {
							maxHeight :options.scrollHeight,
							overflow :'auto'
						});
						if ($.browser.msie
								&& typeof document.body.style.maxHeight === "undefined") {
							var listHeight = 0;
							listItems.each( function() {
								listHeight += this.offsetHeight;
							});
							var scrollbarsVisible = listHeight > options.scrollHeight;
							list.css('height',
									scrollbarsVisible ? options.scrollHeight
											: listHeight);
							if (!scrollbarsVisible) {
								var width1 = list.width()
								- parseInt(listItems.css("padding-left"))
								- parseInt(listItems.css("padding-right"));
								listItems.width("200");
							}
						}
					}
				},
				selected : function() {
					var selected = listItems
							&& listItems.filter("." + CLASSES.ACTIVE).removeClass(
									CLASSES.ACTIVE);
					return selected && selected.length && selected.data("ac_data");
				},
				selected_1 : function() {
					var selected = listItems
					&& listItems.filter("." + CLASSES.ACTIVE);
					return selected && selected.length && selected.data("ac_data");
				},
				emptyList : function() {
					list && list.empty();
				},
				unbind : function() {
					list && list.remove();
				}
			};
		};
		/* ##검색어자동완성 데이터 구성하는 부분 */	
	$.fn.selection = function(start, end) {
		if (start !== undefined) {
			return this.each( function() {
				if (this.createTextRange) {
					var selRange = this.createTextRange();
					if (end === undefined || start == end) {
						selRange.move("character", start);
						selRange.select();
					} else {
						selRange.collapse(true);
						selRange.moveStart("character", start);
						selRange.moveEnd("character", end);
						selRange.select();
					}
				} else if (this.setSelectionRange) {
					this.setSelectionRange(start, end);
				} else if (this.selectionStart) {
					this.selectionStart = start;
					this.selectionEnd = end;
				}
			});
		}
		var field = this[0];
		if (field.createTextRange) {
			var range = document.selection.createRange(), orig = field.value, teststring = "<->", textLength = range.text.length;
			range.text = teststring;
			var caretAt = field.value.indexOf(teststring);
			field.value = orig;
			this.selection(caretAt, caretAt + textLength);
			return {
				start :caretAt,
				end :caretAt + textLength
			}
		} else if (field.selectionStart !== undefined) {
			return {
				start :field.selectionStart,
				end :field.selectionEnd
			}
		}
	};
})(jQuery);

/* selectbox plugin (2010.11.1) */
/* Selectbox */
jQuery.fn.selectbox = function () {
	var all_selects = this;

	function hideAll() {
		all_selects.each(function () {
			this.close();
		});
	}

	jQuery('body').bind('click', function () {
		hideAll();
	});

	return this.each(function () {
		var self = this,
			old_selectbox = jQuery(this),
			select_width = parseInt(old_selectbox.width()) - 2,
			old_options = old_selectbox.find('option'),
			selected_index = getSelectedIndex(old_options),
			wrapper, value_holder,
			new_selectbox_string = '<ul class="new-selectbox">',
			new_selectbox, new_options;

		if($j.browser.safari) {
			if(select_width < 50)
				select_width = (50 - select_width) + select_width;
		}

		self.close = function () {
			new_selectbox.slideUp('fast');
			wrapper.css('z-index', 0);
		};

		self.reGen = function () {
			old_options = old_selectbox.find('option');
			new_selectbox.empty();
			new_selectbox_string = [];
			for (var i = 0, len = old_options.length; i < len; i++) {
				new_selectbox_string.push('<li>');
				new_selectbox_string.push(jQuery(old_options[i]).text());
				new_selectbox_string.push('</li>');
			}
			new_selectbox.append(new_selectbox_string.join(''));
			select_width = parseInt(old_selectbox.width()) - 2;
			new_options = new_selectbox.find('li');
			select(jQuery(new_options[0]));
			value_holder.css('width', select_width + 'px');
			new_selectbox.css('width', (select_width - 2) + 'px');
			optionBinder();
		};

		generateNewSelectbox();

		function getSelectedIndex(opts) {
			var index = 0,
				len = opts.length,
				i;
			for (i = 0; i < len; i++) {
				if (jQuery(opts[i]).attr('selected')) {
					index = i;
				}
			}
			return index;
		}

		function generateNewSelectbox() {
			var opt_len = old_options.length,
				i;
			old_selectbox.wrap('<div class="selectbox-wrap" />');
			wrapper = old_selectbox.parent('div.selectbox-wrap');
			for (i = 0; i < opt_len; i++) {
				new_selectbox_string += '<li>' + jQuery(old_options[i]).text() + '</li>';
			}
			new_selectbox_string += '</ul>';
			wrapper.append('<input type="button" class="value-holder" value="' + jQuery(old_options[selected_index]).text() + '">');
			wrapper.append(new_selectbox_string);

			value_holder = wrapper.find('input.value-holder');
			value_holder.css('width', select_width + 'px');
			new_selectbox = wrapper.find('ul.new-selectbox');
			new_selectbox.css('width', (select_width - 2) + 'px');
			new_options = new_selectbox.find('li');
			jQuery(new_options[selected_index]).addClass('selected');
		}

		function select(obj) {
			var index = new_options.index(obj);
			new_options.removeClass('selected');
			obj.addClass('selected');
			old_options.attr('selected', false);
			jQuery(old_options[index]).attr('selected', true);
			value_holder.val(obj.text());
			old_selectbox.change();
		}

		value_holder.bind('click', function (e) {
			e.stopPropagation();
			e.preventDefault();
			if (new_selectbox.css('display') === 'none') {
				hideAll();
			}
	        wrapper.css('z-index', '1');
			new_selectbox.slideToggle(100);
		});

		value_holder.bind('keydown', function (e) {
			var selected = new_options.filter('.selected');
			if (e.keyCode === 40) {	// Down Arrow
				e.preventDefault();
				if (selected.next().length) {
					select(selected.next());
				}
			} else if (e.keyCode === 38) {	// Up Arrow
				e.preventDefault();
				if (selected.prev().length) {
					select(selected.prev());
				}
			} else if (e.keyCode === 9) {
				new_selectbox.slideUp(100);
				wrapper.css('z-index', '0');
			}
		});

		optionBinder();

		function optionBinder() {
			new_options.bind('click', function () {
				select(jQuery(this));
				new_selectbox.slideUp(100);
				wrapper.css('z-index', '0');
				// value_holder.focus();
			});
			new_options.hover(function () {
				new_options.removeClass('selected');
				new_options.removeClass('hover');
				jQuery(this).addClass('hover');
			});
		}
		/*
		if (IE && (IE < 8)) {
			wrapper.css('position', 'static');
			var pos = value_holder.position();
			new_selectbox.css({
				position: 'absolute',
				top: (pos.top + 17) + 'px',
				left: pos.left
			});
		}
		*/
		this.newSelect = new_selectbox;
	});
};

/*
 * Use jQuery Autocomplete plugin 1.1
 *
 * Use global search  
 */

jQuery(document).ready(function() {
	var acOptions2 = {
			delay: 700,
			loadingClass: "ac_loading",
			minChars: 1,
			max: 10,
			scroll: false,
			dataType: 'json', // this parameter is currently unused
			extraParams: {
				format: 'json' // pass the required context to the Zend Controller
			},
			heightOffset: function(offsetTop, inputOffsetHeight){
				//if offsetTop > 100 >> application search side autoComplete width
				var resultTop = offsetTop + inputOffsetHeight;
				return offsetTop > 100 ? resultTop -1 : resultTop +2;
			},
			widthOffset: function(offsetTop, leftValue ){
				//if offsetTop > 100 >> application search side autoComplete width
				return offsetTop > 100 ? leftValue : leftValue - 9;
			},
			width: 174,
			parse: function(data) {
				var parsed = [];
				if (data != null) {
					data = data.productList;
					for (var i = 0; i < data.length; i++) {
						parsed[parsed.length] = {
								data         : data[i],
								value        : data[i].productNm,
								result       : data[i].productNm,
								productID    : data[i].productID,
								productNm    : data[i].productNm,
								categoryNm   : data[i].categoryNm,
								img          : data[i].img,
								rating       : data[i].rating,
								discountPrice: data[i].discountPrice,
								type 		 : data[i].serviceType
						};
					}
				}
				return parsed;
			},
			parse_bak: function(data) {
				var parsed = [];
				if (data != null) {
					data = data.productList;
					for (var i = 0; i < data.length; i++) {
						parsed[parsed.length] = {
								data: data[i],
								value: data[i].productNm,
								result: data[i].productNm
							};
					}
				}
				return parsed;
			},
			type: function(type) {
				var str = '';
				if(type == '1')
				{
					str = 'Smart Phone Apps';
				}
				else if(type == '2')
				{
					str = 'Mobile Phone...';
				}
				else if(type == '3')
				{
					str = 'FAQ';
				}
				else
				{
					str = 'Smart Phone Apps';
				}
				return str;
			},
			image: function(image) {
				var lastIndex = image.lastIndexOf(".");
				var sizedImage = image.substring(0,lastIndex) + "_45_45" + image.substring(lastIndex);
				
				var imageObj=new Image(30, 30);
				imageObj.src = $j("#registedImageDomain").val() + sizedImage;
				return imageObj;
			},
			mobileImage: function(image) {
				var imageObj=new Image(30, 30);
				imageObj.src = image;
				return imageObj;
			}, 
			//new
			formatItem: function(item) {
				var tmpProductNm = item.productNm;
				/*자동완선 말줄임 부분
				 * hiake
				 * */
				if(calculateBytes(tmpProductNm) > 23){
					var str = tmpProductNm;
					var st = 0;
					var ed = 23;
					var string = null;
					tmpProductNm = byteSubstring(str, st,ed);
					tmpProductNm += "..";}
				
				return { 
						"productID"  : item.productID,
						"productNm"  : tmpProductNm,
						"categoryNm" : item.categoryNm,
						"img"        : item.img, 
						"discountPrice" : item.discountPrice,
						"serviceType" : item.serviceType
						};
				
			},
			//original
			formatItem_bak: function(item) {
					
					return item.productNm;
			}
		};
	
		$j(".ajaxSearch2").globalautocomplete($j(".ajaxGlobalSearchURL").val(), acOptions2);
		
		$j("#signupForm #countries").change(
			function() {
				var selected = $j("#countries option:selected");
				if (selected.val() != 0) {
					$j("#changeLocale input").attr('value', selected.val());
					$j("#changeLocale").submit();
				}
			}
		);
		
		$j(".close").live("click", $j.fancybox.close);
		
		try {
			$j(".close.fancybox").live("click", parent.$j.fancybox.close);
		}catch(exception){}
		
		// Check if map exists
		if($j('#atlas')) {
			// Loop through each AREA in the imagemap
			$j('#atlas area').each(function() {
				
				// Assigning an action to the mouseover event
				$j(this).mouseover(function(e) {
					var country_id = $j(this).attr('id').replace('area_', '');
					$j('#'+country_id).show();
				});
				
				// Assigning an action to the mouseout event
				$j(this).mouseout(function(e) {
					var country_id = $j(this).attr('id').replace('area_', '');
					$j('#'+country_id).hide();
				});
				
				// Assigning an action to the click event
				/*
				$j(this).click(function(e) {
					e.preventDefault();
					var country_id = $j(this).attr('id').replace('area_', '');
					alert('You clicked ' + country_id);
				});
				*/
			});
		}
		
});
/* SubString by bytes*/
function byteSubstring(str,st,ed){
	 var arr = [];
	 var b = 0;
	 for(var i=0,m=str.length;i<m;i++){
	 
	  if(str.charCodeAt(i)>127){
	   arr.push(i);
	   arr.push(i);
	  }else{
	   arr.push(i);
	  }
	  
	 }
	 if(arr[st]==arr[ed]){
	  return false;
	 }else{
	  return str.substring(arr[st],arr[ed])
	 }
}
/*get Bytes of String*/
function calculateBytes(szValue)
{
  var tcount = 0; 
  var tmpStr = new String(szValue);
  var temp = tmpStr.length;
 
  var onechar;
  for ( k=0; k<temp; k++ )
  {
    onechar = tmpStr.charAt(k);
    
    if (escape(onechar).length > 4)
    {
      tcount += 2;
    }
    else
    {
      tcount += 1;
    }
  }
 
  return tcount;
}


function ncomAutoComplete(mkt_keyword, product_nm){
	var tmpStr =product_nm;
	var dotStr="|";
	var chrStr="";
	var result_nm="";
	var arry_chrStr=new Array();
	var arry_tmpStr=new Array();
	for(var w=1; w< mkt_keyword.length; w++){
		dotStr+="|";
	}
	//console.log(dotStr);
	chrStr=tmpStr.toUpperCase().split(mkt_keyword.toUpperCase()).join(dotStr);
	//console.log(chrStr);
	for(var z=0; z< chrStr.length;z++){
		arry_chrStr[z] = chrStr.charAt(z);
		//console.log(arry_chrStr[z]);
	}
	for(var y=0; y< tmpStr.length;y++){
		arry_tmpStr[y] = tmpStr.charAt(y);
		//console.log(arry_tmpStr[y]);
	}
    var dotCnt = 0;
    //console.log(chrStr.length);
	for(var x=0; x< chrStr.length; x++){
		if("|" == arry_chrStr[x]){ 
			if (dotCnt == 0){
				if(mkt_keyword.length ==1){
					result_nm += "<em>" + arry_tmpStr[x]+"<\/em>"; 
				}else{
					result_nm += "<em>" + arry_tmpStr[x]; 
					dotCnt++;
				}
			}else if (dotCnt == mkt_keyword.length - 1){
				result_nm += arry_tmpStr[x] + "<\/em>";
				dotCnt=0;
			}else {
				result_nm += arry_tmpStr[x];
				dotCnt++;
			}
		}else {
			result_nm += arry_tmpStr[x];
			dotCnt=0;
		}
	}
//console.log(result_nm);
	return product_nm = result_nm;
}

function trim(str){
//	console.log(str);
	str = str.replace(/(^\s*)|(\s*$)/g, "");
	return str;
}
